<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 25px;
            height: 25px;
            border:1px gold solid;
            margin-top: 15px;
        }

        .one{
            background-color: red;
        }
        .two{
            background-color: violet;
        }
        .three{
            background-color: greenyellow;
        }

    </style>


</head>
<body>
    <div class='one'></div>
    <div class='two'></div>
    <div class='three'></div>
</body>
</html>
<script src='../util/Util.js'></script>
<script>
    //获得div元素的集合
    let divList = document.getElementsByTagName('div');
    //保存当前的颜色
    let currentColor= getStyle(document.getElementsByTagName('body')[0],'color');

    for(let divObj of divList){
        divObj.onmouseover=function(){
             console.log('1111');
        }

        divObj.onmouseout=function(){
            console.log('2222');
        }
    }
  
  </script>
